﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LTJ.Common;
using LTJ.Entity;
using LTJ.Data;
using LTJ.FrameWork;

namespace uswinweb.admin
{
    public partial class basedata_add :AdminPage
    {
        public string bcode = SASRequest.GetString("bid");
        public BaseTypeInfo btInfo = new BaseTypeInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            btInfo = BaseTypes.GetBaseTypeCode(bcode);
            if (SASRequest.IsPost())
            {
                AddBaseData();
            }
        }
        protected void AddBaseData()
        {
            string tcode = SASRequest.GetFormString("bTcodetxt");
            string name = SASRequest.GetFormString("bnametxt");
            string ename = SASRequest.GetFormString("bEnametxt");
            string expo1 = SASRequest.GetFormString("port_check");
            string expo2 = SASRequest.GetFormString("routes_hidd_luffy");
            string expo3 = SASRequest.GetFormString("national_hidd_luffy");
            BaseDataInfo bInfo = new BaseDataInfo();
            bInfo.code=bcode;
            bInfo.tcode=tcode;
            bInfo.name=name;
            bInfo.ename=ename;
            bInfo.expand1=expo1;
            bInfo.expand2=expo2;
            bInfo.expand3=expo3;

            int msg = BaseDatas.CreateBaseData(bInfo);
            if (msg > 0)
            {
                base.RegisterStartupScript("PAGE", "parent.document.getElementById('reclick').click();parent.Lightview.hide();");
            }
            else
            {
                if (msg == -1)
                {
                    base.RegisterStartupScript("PAGETEMPLATE", "此基础数据已存在！");
                }
                else
                {
                    base.RegisterStartupScript("PAGETEMPLATE", "基础数据添加失败!");
                }
            }
        }
    }
}